import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '检查表名称',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '检查标准类型',
    align:"center",
    dataIndex: 'inspectionStandardType'
   },
   {
    title: '检查目的',
    align:"center",
    dataIndex: 'aim'
   },
   {
    title: '检查要求',
    align:"center",
    dataIndex: 'demand'
   },
   {
    title: '附件',
    align:"center",
    dataIndex: 'attachments',
   },
   // {
   //  title: '是否删除',
   //  align:"center",
   //  dataIndex: 'deleted_dictText'
   // },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "检查表名称",
      field: "name",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"tb_base_check,name,id"
      },
      //colProps: {span: 6},
 	},
	{
      label: "检查标准类型",
      field: "inspectionStandardType",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"inspectionStandardType"
      },
      //colProps: {span: 6},
 	},
	{
      label: "检查目的",
      field: "aim",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "检查要求",
      field: "demand",
      component: 'Input',
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '检查表名称',
    field: 'name',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"tb_base_check,name,id"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入检查表名称!'},
          ];
     },
  },
  {
    label: '检查标准类型',
    field: 'inspectionStandardType',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"inspectionStandardType"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入检查标准类型!'},
          ];
     },
  },
  {
    label: '检查目的',
    field: 'aim',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入检查目的!'},
          ];
     },
  },
  {
    label: '检查要求',
    field: 'demand',
    component: 'InputTextArea',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入检查要求!'},
          ];
     },
  },
  {
    label: '附件',
    field: 'attachments',
    component: 'JUpload',
    componentProps:{
     },
  },
  {
    label: '是否删除',
    field: 'deleted',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"yn"
     },
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const tbBaseCheckItemColumns: JVxeColumn[] = [
    {
      title: '所属任务',
      key: 'taskId',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '检查序号',
      key: 'checkName',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '检查内容',
      key: 'checkContent',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '检查依据',
      key: 'checkBasis',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '适用场合',
      key: 'applicablePlace',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    // {
    //   title: '删除标识',
    //   key: 'deleted',
    //   type: JVxeTypes.input,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    // {
    //   title: '检查表id',
    //   key: 'checkId',
    //   type: JVxeTypes.input,
    //   width:"200px",
    //   placeholder: '请输入${title}',
    //   defaultValue:'',
    // },
    {
      title: '检查方式',
      key: 'checkWay',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  name: {title: '检查表名称',order: 0,view: 'list', type: 'string',dictTable: 'tb_base_check', dictCode: 'id', dictText: 'name',},
  inspectionStandardType: {title: '检查标准类型',order: 1,view: 'list', type: 'string',dictCode: 'inspectionStandardType',},
  aim: {title: '检查目的',order: 2,view: 'textarea', type: 'string',},
  demand: {title: '检查要求',order: 3,view: 'textarea', type: 'string',},
  attachments: {title: '附件',order: 4,view: 'file', type: 'string',},
  // deleted: {title: '是否删除',order: 5,view: 'radio', type: 'string',},
  //子表高级查询
  tbBaseCheckItem: {
    title: '检查项',
    view: 'table',
    fields: {
        taskId: {title: '所属任务',order: 0,view: 'text', type: 'string',},
        checkName: {title: '检查序号',order: 1,view: 'text', type: 'string',},
        checkContent: {title: '检查内容',order: 2,view: 'text', type: 'string',},
        checkBasis: {title: '检查依据',order: 3,view: 'text', type: 'string',},
        applicablePlace: {title: '适用场合',order: 4,view: 'text', type: 'string',},
        // deleted: {title: '删除标识',order: 5,view: 'text', type: 'string',},
        checkId: {title: '检查表id',order: 6,view: 'text', type: 'string',},
        checkWay: {title: '检查方式',order: 7,view: 'text', type: 'string',},
    }
  },
};
